/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { HttpSrv } from 'lfun-bg-comp';
import { ImportParams } from '..';

/** 在职教工 */
export class TeachersSrv {
  /** 列表 */
  public static async list(params: any) {
    return HttpSrv().get('/school/v1/teachers/page', { params: { ...params } });
  }

  /** 删除 */
  public static async delete(id: any) {
    return HttpSrv().delete(`/school/v1/teachers/teacherinfo?teacher_id=${id}`);
  }

  /** 修改 */
  public static async update(params: any) {
    return HttpSrv().put('/school/v1/teachers/teacher', params);
  }

  /** 详情 */
  public static async detail(id: any) {
    return HttpSrv().get(`/school/v1/teachers/teacher?teacher_id=${id}`);
  }

  /** info 详情 */
  public static async info(id: any) {
    return HttpSrv().get(`/school/v1/teachers/teacherinfo?teacher_id=${id}`);
  }

  /** 基本详情修改 */
  public static async infoSubmit(params: any) {
    return HttpSrv().put('/school/v1/teachers/teacherinfo', params);
  }

  /** 基础信息保存 */
  public static async infoSave(params: any) {
    return HttpSrv().put('/school/v1/teachers/teacherinfosave', params);
  }

  /** 恢复在职 */
  public static async active(teacher_id: any, transaction_id: any) {
    return HttpSrv().patch(`/school/v1/teacher-transaction/teacher-active`, { teacher_id, transaction_id });
  }

  /** 恢复在职 */
  public static async activeByBorrow(teacher_id: any, process_instance_id: any) {
    return HttpSrv().patch(`/school/v1/teacher-transaction/teacher-borrow-active`, { teacher_id, process_instance_id });
  }

  /** 变更信息 */
  public static async changeInfo(id: any) {
    return {
      success: true,
      data: [
        {
          key: 'teacherinfo',
          change: [
            { key: 'health_condition', val: 'health_or_good' },
            { key: 'highest_education', val: 'postgraduate_education,doctoral_student_graduation' },
          ],
        },
        {
          key: 'teacher-learn-experience-all',
          change: [{ key: 'education_obtained', val: 'postgraduate_education,doctoral_student_graduation' }],
        },
      ],
    };
  }

  // todo: 链接尚未提供
  public static async importTeacherBasic(params: ImportParams) {
    return HttpSrv().post(`/school/v1/new-teachers/new-teacher-import`, params);
  }

  // todo: 链接尚未提供
  public static async importTeacherShortcut(params: ImportParams) {
    return HttpSrv().post(`/school/v1/new-teachers/new-teacher-import`, params);
  }

  // todo: 链接尚未提供
  public static async importTeacherExtend(params: ImportParams) {
    return HttpSrv().post(`/school/v1/new-teachers/new-teacher-import`, params);
  }

  public static async listApproval(params: any) {
    return HttpSrv().get(`/school/v1/teachers/teacher-info-change-approval`, { params: { ...params } });
  }

  public static async listLaunch(params: any) {
    return HttpSrv().get(`/school/v1/teachers/teacher-info-change-launch`, { params: { ...params } });
  }

  public static async approved(teacher_id: any, process_instance_id: any, reason: string) {
    return HttpSrv().patch(`/school/v1/teachers/teacher-info-change-approved`, {
      teacher_id,
      process_instance_id,
      reason,
    });
  }

  public static async rejected(teacher_id: any, process_instance_id: any, reason: string) {
    return HttpSrv().patch(`/school/v1/teachers/teacher-info-change-rejected`, {
      teacher_id,
      process_instance_id,
      reason,
    });
  }
}
